package org.j5108.action;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import org.j5108.beans.User;

/**
 * Created by lenovo on 2016/5/10.
 */
public class ValidateAction extends ActionSupport /*implements ModelDriven<User> */{
    private User user = new User();
//    @Override
//    public User getModel() {
//        return user;
//    }
    @Override
    public String execute() throws Exception {
        System.out.print(user.getUsername() + "---->" + user.getPassword());
        return SUCCESS;
    }

//    @Override
//    public void validate() {
//        if ( user.getUsername() == null || "".equals(user.getUsername().trim()))
//            addFieldError("username", "用户名不能为空！");
//        if ( user.getPassword() == null || "".equals(user.getPassword().trim()))
//            addFieldError("password", "密码不能为空！");
//    }
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
